/*
 * @Author: your name
 * @Date: 2021-06-07 09:33:43
 * @LastEditTime: 2021-06-16 16:13:26
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \CPP\clientsocket.h
 */
#pragma once
#include<iostream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include<time.h>
#include "case.h"


#define RECV_TIMEOUT 5 //最大等待回复时间
#define MAX_INFO_SIZE 10000 //通信包最大长度

class ClientSocket
{
private:
    //通信套接字
    int m_udp_socket_fd;
    //目的地址
    struct sockaddr_in m_dest_addr;
public:
    char send_buf[MAX_INFO_SIZE];
    int send_length;

    char recv_buf[MAX_INFO_SIZE];
    int recv_length;
public:
    //有参构造
    ClientSocket(char* port,char* des_ip);
    //析构函数
    ~ClientSocket();
    //清理缓存
    void clear_Cache();
    //向服务器发送消息，并将接收到的消息存放在recv_buf里
    bool send_To_Server();
};